import { createApi } from "../configs/ajax";
import { baseURL, path } from '../configs/config'

const prefix = 'usercenter'

const option = { baseURL: baseURL }

export const login = createApi(`${path}/${prefix}/login`, option) //用户登录
export const menu = createApi(`${path}/${prefix}/user/userMenu`, option) //获取菜单选项
export const staff = createApi(`${path}/${prefix}/user/userInfo`, option) // 用户信息
export const loginByTicket = createApi(`${path}/${prefix}/loginByTicket`, option) // 通过ticket登陆


// 模块管理
export const fetchModuleList = createApi(`${path}/${prefix}/resource/list`, option) // 获取模块列表
export const fetchModuleAdd = createApi(`${path}/${prefix}/resource/save`, option) // 新增模块
export const fetchModuleDetail = createApi(`${path}/${prefix}/resource/detail`, option) // 获取模块详情
export const fetchModuleUpdateDetail = createApi(`${path}/${prefix}/resource/update`, option) // 修改按钮模块详情
export const fetchModuleDelete = createApi(`${path}/${prefix}/resource/delete`, option) // 删除模块
export const fetchChangeModuleStatus = createApi(`${path}/${prefix}/resource/updateStatus`, option) // 修改模块显隐状态
export const fetchButtonList = createApi(`${path}/${prefix}/resource/button/list`, option) // 按钮权限列表
export const fetchModuleListInRole = createApi(`${path}/${prefix}/role/resList`, option) // 已选择的模块

// 用户管理
export const fetchUserDepttList = createApi(`${path}/${prefix}/dept/list`, option) //获取部门列表
export const fetchUserDetail = createApi(`${path}/${prefix}/user/detail`, option) // 获取用户详情
export const fetchUserList = createApi(`${path}/${prefix}/user/list`, option) // 获取用户列表
export const fetchUserDetailUpdate = createApi(`${path}/${prefix}/user/update`, option) // 修改用户详情
export const fetchChangeUserStatus = createApi(`${path}/${prefix}/user/updateStatus`, option) // 设置用户是否冻结状态
export const fetchUserAdd = createApi(`${path}/${prefix}/user/save`, option) // 新增用户
export const synUser = createApi(`${path}/${prefix}/user/synUser`, option) // 同步用户

// 角色管理
export const fetchRoleList = createApi(`${path}/${prefix}/role/list`, option) // 角色列表
export const fetchRoleAdd = createApi(`${path}/${prefix}/role/save`, option) // 保存角色
export const fetchTreeList = createApi(`${path}/${prefix}/role/resTree`, option) //获取角色树
export const fetchUpdateRoleRes = createApi(`${path}/${prefix}/role/updateRes`, option) // 更新已选择的模块

